package oop2.shop;

import java.util.Scanner;

public class TestSuperMarket {

	public static void main(String[] args) {
		SuperMarket sm = new SuperMarket("家乐福马鞍山路店");
		Scanner in = new Scanner(System.in);
		int choice = -1;
		while (true) {
			System.out.println("1:查看商场会员信息，2：加新会员，3：积分兑换,4：涨积分， 9:退出");
			choice = in.nextInt();
			if (choice == 1) {
				sm.showInfo();
			} else if (choice == 2) {
				System.out.println("输入卡号：");
				String no = in.next();
				System.out.println("请输入姓名：");
				String name = in.next();
				System.out.println("请输入手机号：");
				String phone = in.next();
				System.out.println("积分:");
				int jifen = in.nextInt();
				// Vip v=new Vip(no,name,phone,jifen);
				// sm.add(v);
				boolean addok = sm.add(no, name, phone, jifen);
				System.out.println(addok ? "添加成功" : "添加失败");
			} else if (choice == 3) {
				System.out.println("请输入会员号：");
				String no = in.next();
				System.out.println("兑换什么 1：餐巾纸，2：剃须刀，3：炒锅");
				int type = in.nextInt();
				String duihuan = sm.exchange(no, type);
				if (duihuan == null) {
					System.out.println("账号不存在或者是积分不够");
				} else {
					System.out.println("成功兑换了" + duihuan);

				}
			} else if (choice == 4) {
				System.out.println("输入卡号和要加上的积分：");
				String no = in.next();
				int newS = in.nextInt();
				boolean add = sm.addScore(no, newS);
				System.out.println(add ? "涨粉成功" : "没有这个会员");
			} else if (choice == 9) {
				System.out.println("退出");
				break;
			}
		}
	}

}
